package com.gzz.orchid.context.infrastructure.support.serial;

import com.gzz.orchid.common.core.support.SerialNoGenerator;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * 采购订单顺序号生成器
 *
 * @author higmd
 */
public class PurchaseSerialNoGenerator extends SerialNoGenerator {

    public PurchaseSerialNoGenerator(RedisTemplate<String, Object> redisTemplate) {
        super(redisTemplate);
    }

    /**
     * 编号(15位)
     */
    public String generateSerialNo() {
        return String.format("PUO%13s", this.getNextSerialId("SN-PURCHASE"))
                .replace(" ", "0");
    }
}
